'use strict';

function compute_chain_median(collection) {
  //在这里写入代码
  let a = collection.split("->").sort((a,b)=>(a-b));
  let L = a.length;
  if(L % 2 === 0){
    return (parseInt(a[L/2-1])+parseInt(a[L/2]))/2;
  }else{
    return a[parseInt(L/2)] ;
  }
}

module.exports = compute_chain_median;
var chain = '1->4->6->2->3->10->9->8->11->20->19->30';
console.log(compute_chain_median(chain));